package DAO.impl;

import DAO.BaseDao;
import DAO.ComplaintDAO;
import bean.Complaint;

import java.sql.Connection;
import java.util.List;

/**
 * @author 栋
 * @date 2022/11/10
 * @description
 */
public class ComplaintADOImpl extends BaseDao<Complaint> implements ComplaintDAO {

    @Override
    public int add_Complaint(Connection conn, Complaint c) {
        String sql="insert into complaint(complaint_id,user1_id,user2_id,introduce,com_date,com_time,admin_id) values(?,?,?,?,?,?,?)";
        return update(conn,sql,c.getComplaint_id(),c.getUser1_id(),c.getUser2_id(),c.getIntroduce(),c.getCom_date(),c.getCom_time(),c.getAdmin_id());
    }

    @Override
    public List<Complaint> get_all_complaint(Connection conn) {
        String sql="select * from complaint";
        return getForList(conn,sql);
    }
}
